{extend name="base/index"/} 
{block name="page_location"}
<div class="row">
	<div class="col-12">
		<div class="page-title-box">
			<div class="page-title-right">
				<ol class="breadcrumb m-0">
					<li class="breadcrumb-item">
						<a href="{:url('index/index')}">管理中心</a>
					</li>
					<li class="breadcrumb-item active"><i class="iconfont icon-angle-right"></i>管理员管理</li>
				</ol>
			</div>
			<h4 class="page-title">
            	{$page_title}
                <a href="javascript:;" data-toggle="modal" data-target="#new_box" id="add_admin_btn" class="btn btn-success btn-sm ml-3">创建管理员</a>
            </h4>
		</div>
	</div>
</div>
{/block} 
{block name="body"}
<div class="row" id="admin_page">
	<div class="col-12">
		<div class="card">
			<div class="card-body">
				<div class="table-responsive-sm">
					<table class="table table-striped table-centered mb-0">
						<thead>
							<tr>
								<th>UID</th>
								<th>管理员头像</th>
								<th>管理员</th>
								<th>管理员昵称</th>
								<th>管理员状态</th>
								<th>最近登录时间</th>
								<th>最近登录IP</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							{volist name='list' id="data"}
							<tr>
								<td style="width: 10%;">{$data.id}</td>
								<td class="table-user"><img class="mr-2 rounded-circle preview_img" src="{$data.facepic}" /></td>
								<td>
									{$data.username} <br />
									<span class="badge badge-primary">
									{switch name="data.type"}
										{case value="0"}普通管理员{/case}
										{case value="1"}超级管理员{/case}
									{/switch}
									</span>
								</td>
								<td>{$data.nickname}</td>
								<td>
									{eq name="data.status" value="0"}
									<a href="javascript:;" attr-model="admin" attr-id="{$data.id}" attr-field="status" attr-val="1" class="badge badge-primary Fast_Action">启用</a>
									{else /}
									<a href="javascript:;" attr-model="admin" attr-id="{$data.id}" attr-field="status" attr-val="0" class="badge badge-secondary Fast_Action">禁用</a>
									{/eq}
								</td>
								<td title="{$data.logintime|date=" Y-m-d H:i:s ",###}">{$data.logintime|date="m-d H:i",###}</td>
								<td>{$data.loginip}</td>
								<td class="table-action">
									<div class="btn-group mb-2">
										<button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">操作</button>
										<div class="dropdown-menu">
											<a class="dropdown-item edit_btn" href="javascript:;" attr-id="{$data.id}" data-toggle="modal" data-target="#edit_box">修改</a>
											<a class="dropdown-item passwd_btn" href="javascript:;" attr-id="{$data.id}" data-toggle="modal" data-target="#passwd_box">改密码</a>
											<a class="dropdown-item privilege_btn" href="{:url('admin/privilege?uid='.$data.id)}">权限</a>
											{neq name="data.username" value="developer"}
											<div class="dropdown-divider"></div>
											<a class="dropdown-item Fast_Del" href="javascript:;" attr-id="{$data.id}" attr-model="admin">删除</a>
											{/neq}
										</div>
									</div>
								</td>
							</tr>
							{/volist}
						</tbody>
					</table>
					<div class="row">
						<div class="col-12" style="text-align: center;">
							{$pagelist}
						</div>
					</div>
				</div>
				<!-- end table-responsive-->
			</div>
			<!-- end card body-->
		</div>
		<!-- end card -->
	</div>
	<!-- end col-->
</div>
{/block} 
{block name="modal_dig"}
<div id="new_box" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog modal-full-70">
		<div class="modal-content">
			<div class="modal-header">
				<h4 class="modal-title" id="myModalLabel">创建新管理员</h4>
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			</div>
			<div class="modal-body">
				<form action="#" class="form-horizontal" id="add_admin_frm">
					<div class="form-group row mb-1">
						<label for="ipt_classid" class="col-3 col-form-label">管理员类型：</label>
						<div class="col-5">
							<select class="form-control" name="type" id="type">
								<option value="0">普通管理员</option>
                              	{eq name="AdminInfo.username" value="developer"}
								<option value="1">超级管理员</option>
                              	{/eq}
							</select>
							<p class="font-13 text-muted"></p>
						</div>
					</div>
					<div class="form-group row mb-1">
						<label for="ipt_config_title" class="col-3 col-form-label">管理员名：</label>
						<div class="col-5">
							<input type="text" class="form-control ipt_check" data-type="string" data-type="enname" data-len="5-20" nullmsg="管理员名称不能为空" errormsg="管理员名称只能由5到20位的字母、数字组成" name="username" placeholder="请输入管理员名">
						</div>
						<div class="col-2">
							<span class="font-13 text-muted">必填</span>
						</div>
					</div>
					<div class="form-group row mb-1">
						<label for="ipt_config_title" class="col-3 col-form-label">管理密码：</label>
						<div class="col-5">
							<input type="text" class="form-control ipt_check" data-type="password" data-len="6-12" passwordStrong="1" StrongMsg="您的密码强度不够" nullmsg="管理员密码不能为空" errormsg="管理员密码只能由6到12位的字符组成" repeated="repassword" repeated-msg="两次输入的密码不一致" name="password" placeholder="请输入管理密码">
						</div>
						<div class="col-2">
							<span class="font-13 text-muted">必填</span>
						</div>
					</div>
					<div class="form-group row mb-1">
						<label for="ipt_config_title" class="col-3 col-form-label">确认密码：</label>
						<div class="col-5">
							<input type="text" class="form-control ipt_check" name="repassword" placeholder="请输入重新输入管理员密码">
						</div>
						<div class="col-2">
							<span class="font-13 text-muted">必填</span>
						</div>
					</div>
					<div class="form-group row mb-1">
						<label for="ipt_config_title" class="col-3 col-form-label">管理员昵称：</label>
						<div class="col-5">
							<input type="text" class="form-control" name="nickname" placeholder="请输入管理员昵称">
						</div>
					</div>
					<div class="form-group row mb-1">
						<label for="ipt_config_title" class="col-3 col-form-label">管理员头像：</label>
						<div class="col-5 faceupload_box">
							<div class="faceupload ipt_check" data-type="upload" attr-inputname="facepic" nullmsg="管理员头像没有上传" attr-value=""  isCompress="1"></div>
						</div>
						<div class="col-2">
							<span class="font-13 text-muted">必填</span>
						</div>
					</div>
					<div class="form-group row mb-1">
						<label for="ipt_isdeveloper" class="col-3 col-form-label">管理状态:</label>
						<div class="col-5">
							<div class="custom-control custom-radio">
								<input type="radio" name="status" id="status1" class="custom-control-input" value="0" checked="checked">
								<label class="custom-control-label" for="status1">启用</label>
							</div>
							<div class="custom-control custom-radio">
								<input type="radio" name="status" id="status2" class="custom-control-input" value="1">
								<label class="custom-control-label" for="status2">禁用</label>
							</div>
						</div>
					</div>
					<div class="form-group row mb-1">
						<label for="ipt_config_title" class="col-3 col-form-label">最近登录时间：</label>
						<div class="col-5">
							<input type="text" readonly="" class="form-control-plaintext" value="0000-00-00 00:00:00">
						</div>
					</div>
					<div class="form-group row mb-1">
						<label for="ipt_config_title" class="col-3 col-form-label">最近登录IP：</label>
						<div class="col-5">
							<input type="text" readonly="" class="form-control-plaintext" value="127.0.0.1">
						</div>
					</div>

				</form>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-light" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary Fast_Form_Post" attr-frm="#add_admin_frm" attr-callback="reload" attr-model="admin" attr-active="add_admin">确认创建</button>
			</div>
		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!-- Modal -->
<div id="edit_box" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog modal-full-70">
		<div class="modal-content">
			<div class="modal-header">
				<h4 class="modal-title" id="myModalLabel">修改管理员</h4>
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			</div>
			<div class="modal-body">
				<form action="#" class="form-horizontal" id="edit_admin_frm">
					<input type="hidden" name="id" value="" />
					<div class="form-group row mb-1">
						<label for="ipt_classid" class="col-3 col-form-label">管理员类型：</label>
						<div class="col-5">
							<select class="form-control" name="type" id="type">
								<option value="0">普通管理员</option>
								<option value="1">超级管理员</option>
							</select>
						</div>
					</div>
					<div class="form-group row mb-1">
						<label for="ipt_config_title" class="col-3 col-form-label">管理员名：</label>
						<div class="col-5">
							<input type="text" class="form-control ipt_check" data-type="string" data-type="enname" data-len="5-20" nullmsg="管理员名称不能为空" errormsg="管理员名称只能由5到20位的字母、数字组成" name="username" placeholder="请输入管理员名">
						</div>
						<div class="col-2">
							<span class="font-13 text-muted">注：必填</span>
						</div>
					</div>
					<div class="form-group row mb-1">
						<label for="ipt_config_title" class="col-3 col-form-label">管理员昵称：</label>
						<div class="col-5">
							<input type="text" class="form-control" name="nickname" placeholder="请输入管理员昵称">
							<span class="font-13 text-muted"></span>
						</div>
					</div>
					<div class="form-group row mb-1">
						<label for="ipt_config_title" class="col-3 col-form-label">管理员头像：</label>
						<div class="col-5 faceupload_box">
							<div class="faceupload_edit form_input_check" data-type="upload" attr-inputname="faceupload_edit" nullmsg="管理员头像没有上传" attr-value=""></div>
						</div>
						<div class="col-2">
							<span class="font-13 text-muted">注：必填</span>
						</div>
					</div>
					<div class="form-group row mb-1">
						<label for="ipt_isdeveloper" class="col-3 col-form-label">管理状态:</label>
						<div class="col-5">
							<div class="custom-control custom-radio">
								<input type="radio" name="status" id="status1_2" class="custom-control-input" value="0">
								<label class="custom-control-label" for="status1_2">启用</label>
							</div>
							<div class="custom-control custom-radio">
								<input type="radio" name="status" id="status2_2" class="custom-control-input" value="1">
								<label class="custom-control-label" for="status2_2">禁用</label>
							</div>
							<span class="font-13 text-muted"></span>
						</div>
					</div>
					<div class="form-group row mb-1">
						<label for="ipt_config_title" class="col-3 col-form-label">最近登录时间：</label>
						<div class="col-5">
							<span class="font-13 text-muted login_time"></span>
						</div>
					</div>
					<div class="form-group row mb-1">
						<label for="ipt_config_title" class="col-3 col-form-label">最近登录IP：</label>
						<div class="col-5">
							<span class="font-13 text-muted login_ip"></span>
						</div>
					</div>
					<div class="form-group row mb-1">
						<label for="ipt_config_title" class="col-3 col-form-label">注册时间：</label>
						<div class="col-5">
							<span class="font-13 text-muted reg_time"></span>
						</div>
					</div>
					<div class="form-group row mb-1">
						<label for="ipt_config_title" class="col-3 col-form-label">注册IP：</label>
						<div class="col-5">
							<span class="font-13 text-muted reg_ip"></span>
						</div>
					</div>
				</form>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-light" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary Fast_Form_Post" attr-frm="#edit_admin_frm" attr-callback="reload" attr-model="admin" attr-active="update_admin">确认修改</button>
			</div>
		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!-- Modal -->
<div id="passwd_box" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog modal-full-70">
		<div class="modal-content">
			<div class="modal-header">
				<h4 class="modal-title" id="myModalLabel">修改密码</h4>
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			</div>
			<div class="modal-body">
				<form action="#" class="form-horizontal" id="edit_passwd_frm">
					<input type="hidden" name="id" value="" />
					<div class="form-group row mb-1">
						<label for="ipt_config_title" class="col-3 col-form-label">旧管理员密码：</label>
						<div class="col-5">
							<input type="text" class="form-control password_input ipt_check" name="oldpassword" placeholder="请输入管理员旧密码" data-type="password" nullmsg="管理员旧密码不能为空" errormsg="管理员旧密码只能由6到12位的字符组成" data-len="6-12">
						</div>
						<div class="col-2">
							<span class="font-13 text-muted">注：必填</span>
						</div>
					</div>
					<div class="form-group row mb-1">
						<label for="ipt_config_title" class="col-3 col-form-label">管理员新密码：</label>
						<div class="col-5">
							<input type="text" class="form-control password_input ipt_check" name="newpassword" placeholder="请输入管理员密码" data-type="password" nullmsg="管理员新密码不能为空" errormsg="管理员新密码只能由6到12位的字符组成" data-len="6-12" repeated="repassword" repeated-msg="两次输入的密码不一致" passwordStrong="1" StrongMsg="您的密码强度不够">
						</div>
						<div class="col-2">
							<span class="font-13 text-muted">注：必填</span>
						</div>
					</div>
					<div class="form-group row mb-1">
						<label for="ipt_config_title" class="col-3 col-form-label">确认新密码：</label>
						<div class="col-5">
							<input type="text" class="form-control password_input ipt_check" name="repassword" placeholder="请输入重新输入管理员密码">
						</div>
						<div class="col-2">
							<span class="font-13 text-muted">注：必填</span>
						</div>
					</div>
				</form>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-light" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary Fast_Form_Post" attr-frm="#edit_passwd_frm" attr-callback="{$BindRoot}/admin/index" attr-model="admin" attr-active="update_password">确认修改</button>
			</div>
		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
{/block}